home *** CD-ROM | disk | FTP | other *** search
/ Side Holy - Aoi Nanase Illust Collection / Holy Side.iso / Html / ImageLoader.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-06-18  |  1.6 KB  |  77 lines

  1. import java.awt.Image;
  2. import java.awt.MediaTracker;
  3. import java.awt.image.ImageObserver;
  4. import java.awt.image.PixelGrabber;
  5.  
  6. class ImageLoader extends Thread {
  7.    protected Image image;
  8.    protected boolean loaded;
  9.    protected boolean error;
  10.    protected int[] pixels;
  11.    // $FF: renamed from: mt java.awt.MediaTracker
  12.    protected MediaTracker field_0;
  13.    protected int myId;
  14.    // $FF: renamed from: id int
  15.    protected static int field_1;
  16.  
  17.    public ImageLoader(Image var1, MediaTracker var2) {
  18.       this.field_0 = var2;
  19.       this.image = var1;
  20.       this.myId = field_1;
  21.       var2.addImage(var1, field_1++);
  22.    }
  23.  
  24.    public boolean isLoaded() {
  25.       return this.loaded;
  26.    }
  27.  
  28.    public boolean isError() {
  29.       return this.error;
  30.    }
  31.  
  32.    public Image getImage() {
  33.       return this.image;
  34.    }
  35.  
  36.    public int[] getPixels() {
  37.       return this.pixels;
  38.    }
  39.  
  40.    public int getWidth() {
  41.       return this.image.getWidth((ImageObserver)null);
  42.    }
  43.  
  44.    public int getHeight() {
  45.       return this.image.getHeight((ImageObserver)null);
  46.    }
  47.  
  48.    public void run() {
  49.       ((Thread)this).setPriority(3);
  50.  
  51.       try {
  52.          this.field_0.waitForID(this.myId);
  53.       } catch (InterruptedException var6) {
  54.          ((Throwable)var6).printStackTrace();
  55.          return;
  56.       }
  57.  
  58.       if (this.field_0.isErrorID(this.myId)) {
  59.          this.error = true;
  60.       } else {
  61.          int var1 = this.image.getWidth((ImageObserver)null);
  62.          int var2 = this.image.getHeight((ImageObserver)null);
  63.          this.pixels = new int[var1 * var2];
  64.          PixelGrabber var3 = new PixelGrabber(this.image, 0, 0, var1, var2, this.pixels, 0, var1);
  65.  
  66.          try {
  67.             var3.grabPixels();
  68.          } catch (InterruptedException var5) {
  69.             ((Throwable)var5).printStackTrace();
  70.             return;
  71.          }
  72.  
  73.          this.loaded = true;
  74.       }
  75.    }
  76. }
  77.